package com.cqq.base.velocity;

import java.util.List;

import org.apache.velocity.tools.Scope;
import org.apache.velocity.tools.config.DefaultKey;
import org.apache.velocity.tools.config.ValidScope;

import com.cqq.base.util.TagUtil;
import com.cqq.common.core.util.SpringContextUtil;
import com.cqq.print.base.service.bean.PPriceBean;
import com.cqq.print.base.service.bean.PProducePlanBean;


/**
 * <h3>Velocity 标签显示工具类</h3>
 * 
 * @author CHENQQ
 * @version 1.0.0
 * 
 */
@DefaultKey("tag")
@ValidScope(Scope.APPLICATION)
public class TagTool implements TagUtil {

	private TagUtil tagUtil;

	public TagTool() {
	}

	public TagUtil getTagUtil() {
		if (tagUtil == null) {
			this.tagUtil = SpringContextUtil.getBean(TagUtil.class);
		}
		return tagUtil;
	}
	
	public String getOrganizationName(Integer OrgId) {
		return getTagUtil().getOrganizationName(OrgId);
	}

	public String getUsername(Integer userId) {
		return getTagUtil().getUsername(userId);
	}

	public String getUsername(Integer[] userIds, String separator) {
		return getTagUtil().getUsername(userIds, separator);
	}

	
	public String getRealName(Integer userId) {
		return getTagUtil().getRealName(userId);
	}

	
	public String getRealName(Integer[] userIds, String separator) {
		return getTagUtil().getRealName(userIds, separator);
	}
	
	public <S, T> String join(List<T> source, String fieldName, String separator) {
		return getTagUtil().join(source, fieldName, separator);
	}
	
	public String getProPlanName(Integer proPlanId) {
		return getTagUtil().getProPlanName(proPlanId);
	}

	public List<PProducePlanBean> getProducePlanList() {
		return getTagUtil().getProducePlanList();
	}

	public PPriceBean getPPriceByProPlanId(Integer proPlanId) {
		PPriceBean bean = getTagUtil().getPPriceByProPlanId(proPlanId);
		return bean;
	}

	public String getPPubName(Integer pubId) {
		return getTagUtil().getPPubName(pubId);
	}
}